public class day11 {public static void main(String[] args) {
    int[] arr = {1,3,4,7,9};
    int a = getArrayMaxNo2(arr);
    System.out.println(a);
}
    public static int getArrayMaxNo2(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = i+1; j < arr.length; j++) {
                if (arr[i]>arr[j]){
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        return arr[arr.length-2];
    }
}

